package com.atguigu.acyjl;

import android.view.View;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
import android.view.animation.AnimationSet;
import android.view.animation.TranslateAnimation;
import android.widget.Button;

import com.atguigu.acyjl.activity.MainActivity;

import java.util.ArrayList;
import java.util.List;


public class Settings {
    int[] locBlank1 = new int[2];
    int[] locBlank2 = new int[2];
    int[] locBlank3 = new int[]{0, 0};
    int[] locBlank4 = new int[]{0, 0};
    int[] locBlank5 = new int[]{0, 0};
    int[] locBlank6 = new int[]{0, 0};
    int[] locBlank7 = new int[]{0, 0};
    int[] locBlank8 = new int[]{0, 0};
    public int count = 0;
    Button locatorMoving;
    static int levelSetting=0;
    int idiomID=0;

    private TranslateAnimation[] translateAnimations1 = new TranslateAnimation[]{};
    private TranslateAnimation[] translateAnimations2 = new TranslateAnimation[]{};
    private ArrayList<TranslateAnimation[]> translateAnimationsList = new ArrayList<>();//目前三关,后面再赋值

    Boolean isw1R = false;
    Boolean isw2R = false;
    Boolean isw3R = false;
    Boolean isw4R = false;
    Boolean isw5R = false;
    Boolean isw6R = false;
    Boolean isw7R = false;
    Boolean isw8R = false;

    List<Idiom> list;
    List<EasyIdiom> easyList;
    public void getList(List idiomsList){ list = idiomsList; }
    public void getEasyList(List idiomsEasyList) {easyList = idiomsEasyList;}

    ShowExplanation showExplanation = new ShowExplanation();
    MoveUtils moveUtils = new MoveUtils();

    public static String score="0";

    public Boolean winFlag=false;

    public static int isMarketFirstShow = 0;





    //方法区域////////////////////////////////////////////////////////
    public void addStar(){
        MainActivity.mainActivity.btnStars.setText(String.valueOf(
                Integer.parseInt(MainActivity.mainActivity.btnStars.getText().toString())+1));
    }

    public void locatorInfo(Button locator) {
        locatorMoving = locator;
        //复合动画（透明度平移）+坐标 定位locator初始位置
        //1.初始坐标 通过下方blank方法获取的locBlank int[]
        //2.复合动画
        AlphaAnimation alphaAnimation = new AlphaAnimation(0, 1);
        alphaAnimation.setDuration(10);
        TranslateAnimation translateAnimation = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0,
                Animation.ABSOLUTE, locBlank1[0] - 10, Animation.RELATIVE_TO_SELF, 0,
                Animation.ABSOLUTE, locBlank1[1] - 90);
        translateAnimation.setDuration(10);
        AnimationSet animationSet = new AnimationSet(true);
        animationSet.addAnimation(alphaAnimation);
        animationSet.addAnimation(translateAnimation);
//        animationSet.setStartOffset(3000);
        animationSet.setFillAfter(true);
        locatorMoving.startAnimation(animationSet);

    }


    public void task(int level, Button... btnText) {
        String[] Q1 = new String[]{"巧", "争", "分", "秒", "天"};
        String[] Q2 = new String[]{"峰", "妙", "手", "路", "转"};
        String[] Q3 = new String[]{"谈", "身", "风", "绝", "逢", "地"};
        String[] Q4 = new String[]{"不","知","负","不","莫","及"};
        for (int i = 0; i < btnText.length; i++) {
            btnText[i].setBackground(MainActivity.mainActivity.getResources().getDrawable(R.drawable.challenge_filled));
            if (level == 1)
                btnText[i].setText(Q1[i]);
            if (level == 2)
                btnText[i].setText(Q2[i]);
            if (level == 3)
                btnText[i].setText(Q3[i]);
            if (level == 4)
                btnText[i].setText(Q4[i]);
        }
    }

    public void getLocBlank(int... lB) {
        for (int i = 0; i < lB.length; i++) {
            if (i >= 0 && i <= 1)
                locBlank1[i] = lB[i];
            else if (i >= 2 && i <= 3)
                locBlank2[i - 2] = lB[i];
            else if (i >= 4 && i <= 5)
                locBlank3[i - 4] = lB[i];
            else if (i >= 6 && i <= 7)
                locBlank4[i - 6] = lB[i];
            else if (i >=8 && i <= 9)
                locBlank5[i - 8] = lB[i];
            else if (i >= 10 && i <= 11)
                locBlank6[i - 10] = lB[i];
            else if (i >= 12 && i <= 13)
                locBlank7[i - 12] = lB[i];
            else if (i >= 14 && i <= 15)
                locBlank8[i - 14] = lB[i];
        }
    }

    public void blank(Button... btnBlank) {
        for (int i = 0; i < btnBlank.length; i++) {
            btnBlank[i].setBackground(MainActivity.mainActivity.getResources().getDrawable(R.drawable.challenge_wordbac));
            btnBlank[i].setText("");
        }
    }

    public void answer(int level, Button... btnAnswer) {
        String A1[] = new String[]{"工", "夺"};
        String A2[] = new String[]{"春", "回"};
        String A3[] = new String[]{"笑", "处", "生", "设"};
        String A4[] = new String[]{"措","望","众","所","尘","手","x","x"};
        for (int i = 0; i < btnAnswer.length; i++) {
            if (level == 1)
                btnAnswer[i].setText(A1[i]);
            if (level == 2)
                btnAnswer[i].setText(A2[i]);
            if (level == 3) {
                if (i >= 2)
                    btnAnswer[i].setBackground(MainActivity.mainActivity.getResources().getDrawable(R.drawable.challenge_wordbac));
                btnAnswer[i].setText(A3[i]);
            }
            if (level == 4){
                if (i >= 2)
                    btnAnswer[i].setBackground(MainActivity.mainActivity.getResources().getDrawable(R.drawable.challenge_wordbac));
                btnAnswer[i].setText(A4[i]);
            }
        }
    }





    Boolean word1Flag=false;//word1是否被移动过的标记
    Boolean word2Flag=false;//word2是否被移动过的标记
    Boolean word3Flag=false;
    Boolean word4Flag=false;
    Boolean word5Flag=false;
    Boolean word6Flag=false;
    Boolean word7Flag=false;
    Boolean word8Flag=false;
    public void Click() {
        MainActivity.mainActivity.word1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
//                Log.d("soundID",String.valueOf(MainActivity.mainActivity.soundID));
                MainActivity.mainActivity.playSounds.playSound();
                word1Flag = true;//word1按下
                contentsClick(levelSetting);//locator和answer的移动在这里面, iswxR的更新也在这里
                count++;
                word1Flag = false;
                judgement();
                showExplanation.showExplanation(levelSetting,idiomID,isw1R,isw2R,isw3R,isw4R,isw5R,isw6R,isw7R,isw8R);
            }
        });

        MainActivity.mainActivity.word2.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                MainActivity.mainActivity.playSounds.playSound();
                word2Flag = true;//word1按下
                contentsClick(levelSetting);
                count++;
                word2Flag = false;
                judgement();
                showExplanation.showExplanation(levelSetting,idiomID,isw1R,isw2R,isw3R,isw4R,isw5R,isw6R,isw7R,isw8R);
            }
        });

        MainActivity.mainActivity.word3.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                MainActivity.mainActivity.playSounds.playSound();
                word3Flag = true;
                contentsClick(levelSetting);
                count++;
                word3Flag = false;
                judgement();
                showExplanation.showExplanation(levelSetting,idiomID,isw1R,isw2R,isw3R,isw4R,isw5R,isw6R,isw7R,isw8R);
            }
        });

        MainActivity.mainActivity.word4.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                MainActivity.mainActivity.playSounds.playSound();
                word4Flag = true;
                contentsClick(levelSetting);
                count++;
                word4Flag = false;
                judgement();
                showExplanation.showExplanation(levelSetting,idiomID,isw1R,isw2R,isw3R,isw4R,isw5R,isw6R,isw7R,isw8R);
            }
        });

        MainActivity.mainActivity.word5.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                MainActivity.mainActivity.playSounds.playSound();
                word5Flag = true;
                contentsClick(levelSetting);
                count++;
                word5Flag = false;
                judgement();//获取了idiomID
                showExplanation.showExplanation(levelSetting,idiomID,isw1R,isw2R,isw3R,isw4R,isw5R,isw6R,isw7R,isw8R);
            }
        });

        MainActivity.mainActivity.word6.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                MainActivity.mainActivity.playSounds.playSound();
                word6Flag = true;
                contentsClick(levelSetting);
                count++;
                word6Flag = false;
                judgement();
                showExplanation.showExplanation(levelSetting,idiomID,isw1R,isw2R,isw3R,isw4R,isw5R,isw6R,isw7R,isw8R);
            }
        });

        MainActivity.mainActivity.word7.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                MainActivity.mainActivity.playSounds.playSound();
                word7Flag = true;
                contentsClick(levelSetting);
                count++;
                word7Flag = false;
                judgement();
                showExplanation.showExplanation(levelSetting,idiomID,isw1R,isw2R,isw3R,isw4R,isw5R,isw6R,isw7R,isw8R);
            }
        });

        MainActivity.mainActivity.word8.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                MainActivity.mainActivity.playSounds.playSound();
                word8Flag = true;
                contentsClick(levelSetting);
                count++;
                word8Flag = false;
                judgement();
                showExplanation.showExplanation(levelSetting,idiomID,isw1R,isw2R,isw3R,isw4R,isw5R,isw6R,isw7R,isw8R);
            }
        });



    }//Click结束

    Boolean addByWord1 = false;
    Boolean addByWord2 = false;
    Boolean addByWord3 = false;
    Boolean addByWord4 = false;
    Boolean addByWord5 = false;
    Boolean addByWord6 = false;
    Boolean addByWord7 = false;
    Boolean addByWord8 = false;

    public void judgement() {
//        List<Idiom> list = MainActivity.mainActivity.wordDao.getAllWords();
        if (levelSetting == 1) {
            if (isw1R) {
                MainActivity.mainActivity.word1.setBackground(MainActivity.mainActivity.getResources().getDrawable(R.drawable.challenge_filled));
                isw1R = false;
            } else if (isw2R) {
                MainActivity.mainActivity.word2.setBackground(MainActivity.mainActivity.getResources().getDrawable(R.drawable.challenge_filled));
                isw2R = false;
            }
        } else if (levelSetting == 2) {
            //word2置绿
            for (int i = 1; i < list.size() - 2; i++) {//若数据库中出现过btn连接的词，则答案正确
                if (MainActivity.mainActivity.btn32.getText().toString()
                        .concat(MainActivity.mainActivity.btn33.getText().toString())
                        .concat(MainActivity.mainActivity.btn34.getText().toString())
                        .equals(String.valueOf(list.get(i).getIdiom().charAt(0))
                                .concat(String.valueOf(list.get(i).getIdiom().charAt(1)))
                                .concat(String.valueOf(list.get(i).getIdiom().charAt(2))))) {
                    MainActivity.mainActivity.word2.setBackground(MainActivity.mainActivity.getResources().getDrawable(R.drawable.challenge_filled));
                }
            }
            //word1置绿
            if (MainActivity.mainActivity.btn35.getText() == "春") {
                MainActivity.mainActivity.word1.setBackground(MainActivity.mainActivity.getResources().getDrawable(R.drawable.challenge_filled));
            }
        } else if (levelSetting == 3) {
            //word4置绿
            for (int i = 1; i < list.size() - 2; i++) {
                if (list.get(i).getIdiom().length() >= 4) {
                    if (MainActivity.mainActivity.btn23.getText().toString().concat(MainActivity.mainActivity.btn33
                            .getText().toString()).concat(MainActivity.mainActivity.btn53.getText().toString())
                            .equals(String.valueOf(list.get(i).getIdiom().charAt(0)).concat(String.valueOf(list.get(i).getIdiom().charAt(1)))
                                    .concat(String.valueOf(list.get(i).getIdiom().charAt(3))))) {
                        MainActivity.mainActivity.word4.setBackground(MainActivity.mainActivity.getResources().getDrawable(R.drawable.challenge_filled));
                    }
                }
            }
            //word1置绿
            for (int i = 1; i < list.size() - 2; i++) {
                if (MainActivity.mainActivity.btn15.getText().toString().concat(MainActivity.mainActivity.btn25
                        .getText().toString()).concat(MainActivity.mainActivity.btn35.getText().toString())
                        .equals(String.valueOf(list.get(i).getIdiom().charAt(0)).concat(String.valueOf(list.get(i).getIdiom().charAt(1)))
                                .concat(String.valueOf(list.get(i).getIdiom().charAt(2))))) {
                    MainActivity.mainActivity.word1.setBackground(MainActivity.mainActivity.getResources().getDrawable(R.drawable.challenge_filled));
                }
            }
            //word2置绿
            for (int i = 1; i < list.size() - 2; i++) {
                if (MainActivity.mainActivity.btn42.getText().toString().concat(MainActivity.mainActivity.btn43
                        .getText().toString()).concat(MainActivity.mainActivity.btn44.getText().toString())
                        .equals(String.valueOf(list.get(i).getIdiom().charAt(0)).concat(String.valueOf(list.get(i).getIdiom().charAt(1)))
                                .concat(String.valueOf(list.get(i).getIdiom().charAt(2))))) {
                    MainActivity.mainActivity.word2.setBackground(MainActivity.mainActivity.getResources().getDrawable(R.drawable.challenge_filled));
                }
            }
            //word3置绿
            for (int i = 1; i < list.size() - 2; i++) {
                if (list.get(i).getIdiom().length() >= 4) {
                    if (MainActivity.mainActivity.btn43.getText().toString().concat(MainActivity.mainActivity.btn44
                            .getText().toString()).concat(MainActivity.mainActivity.btn45.getText().toString())
                            .equals(String.valueOf(list.get(i).getIdiom().charAt(1)).concat(String.valueOf(list.get(i).getIdiom().charAt(2)))
                                    .concat(String.valueOf(list.get(i).getIdiom().charAt(3))))) {
                        MainActivity.mainActivity.word3.setBackground(MainActivity.mainActivity.getResources().getDrawable(R.drawable.challenge_filled));
                    }
                }
            }

        }else if(levelSetting==4){//416325

            //word4置绿
            for (int i = 1; i < easyList.size() - 2; i++) {
                if (easyList.get(i).getEasyCY().length() >= 4) {
                    if (MainActivity.mainActivity.btn22.getText().toString().concat(MainActivity.mainActivity.btn23
                            .getText().toString()).concat(MainActivity.mainActivity.btn24.getText().toString())
                            .equals(String.valueOf(easyList.get(i).getEasyCY().charAt(0)).concat(String.valueOf(easyList.get(i).getEasyCY().charAt(1)))
                                    .concat(String.valueOf(easyList.get(i).getEasyCY().charAt(2))))) {
                        idiomID = i;
                        MainActivity.mainActivity.word4.setBackground(MainActivity.mainActivity.getResources().getDrawable(R.drawable.challenge_filled));
                        if(addByWord4==false)
                        {
                            addByWord4=true;

                        }
                    }
                }
            }
            //word1置绿
            for (int i = 1; i < easyList.size() - 2; i++) {
                if (easyList.get(i).getEasyCY().length() >= 4) {
                    if (MainActivity.mainActivity.btn23.getText().toString().concat(MainActivity.mainActivity.btn24
                            .getText().toString()).concat(MainActivity.mainActivity.btn25.getText().toString())
                            .equals(String.valueOf(easyList.get(i).getEasyCY().charAt(1)).concat(String.valueOf(easyList.get(i).getEasyCY().charAt(2)))
                                    .concat(String.valueOf(easyList.get(i).getEasyCY().charAt(3))))) {
                        idiomID = i;
                        MainActivity.mainActivity.word1.setBackground(MainActivity.mainActivity.getResources().getDrawable(R.drawable.challenge_filled));
                        if(addByWord1==false)
                        {
                            addByWord1=true;

                        }
                    }
                }
            }
            //word6置绿
            for (int i = 1; i < easyList.size() - 2; i++) {
                if (easyList.get(i).getEasyCY().length() >= 4) {
                    if (MainActivity.mainActivity.btn25.getText().toString().concat(MainActivity.mainActivity.btn35
                            .getText().toString()).concat(MainActivity.mainActivity.btn45.getText().toString())
                            .equals(String.valueOf(easyList.get(i).getEasyCY().charAt(0)).concat(String.valueOf(easyList.get(i).getEasyCY().charAt(1)))
                                    .concat(String.valueOf(easyList.get(i).getEasyCY().charAt(2))))) {
                        idiomID = i;
                        MainActivity.mainActivity.word6.setBackground(MainActivity.mainActivity.getResources().getDrawable(R.drawable.challenge_filled));
                        if(addByWord6==false)
                        {
                            addByWord6=true;

                        }
                    }
                }
            }
            //word3置绿
            for (int i = 1; i < easyList.size() - 2; i++) {
                if (easyList.get(i).getEasyCY().length() >= 4) {
                    if (MainActivity.mainActivity.btn22.getText().toString().concat(MainActivity.mainActivity.btn32
                            .getText().toString()).concat(MainActivity.mainActivity.btn42.getText().toString())
                            .equals(String.valueOf(easyList.get(i).getEasyCY().charAt(0)).concat(String.valueOf(easyList.get(i).getEasyCY().charAt(1)))
                                    .concat(String.valueOf(easyList.get(i).getEasyCY().charAt(2))))) {
                        idiomID = i;
                        MainActivity.mainActivity.word3.setBackground(MainActivity.mainActivity.getResources().getDrawable(R.drawable.challenge_filled));
                        if(addByWord3==false)
                        {
                            addByWord3=true;

                        }
                    }
                }
            }
            //word2置绿
            for (int i = 1; i < easyList.size() - 2; i++) {
                if (easyList.get(i).getEasyCY().length() >= 4) {
                    if (MainActivity.mainActivity.btn32.getText().toString().concat(MainActivity.mainActivity.btn42
                            .getText().toString()).concat(MainActivity.mainActivity.btn52.getText().toString())
                            .equals(String.valueOf(easyList.get(i).getEasyCY().charAt(1)).concat(String.valueOf(easyList.get(i).getEasyCY().charAt(2)))
                                    .concat(String.valueOf(easyList.get(i).getEasyCY().charAt(3))))) {
                        idiomID = i;
                        MainActivity.mainActivity.word2.setBackground(MainActivity.mainActivity.getResources().getDrawable(R.drawable.challenge_filled));
                        if(addByWord2==false)
                        {
                            addByWord2=true;

                        }
                    }
                }
            }
            //word5置绿
            for (int i = 1; i < easyList.size() - 2; i++) {
                if (easyList.get(i).getEasyCY().length() >= 4) {
                    if (MainActivity.mainActivity.btn53.getText().toString().concat(MainActivity.mainActivity.btn54
                            .getText().toString()).concat(MainActivity.mainActivity.btn55.getText().toString())
                            .equals(String.valueOf(easyList.get(i).getEasyCY().charAt(1)).concat(String.valueOf(easyList.get(i).getEasyCY().charAt(2)))
                                    .concat(String.valueOf(easyList.get(i).getEasyCY().charAt(3))))) {
                        idiomID = i;
                        MainActivity.mainActivity.word5.setBackground(MainActivity.mainActivity.getResources().getDrawable(R.drawable.challenge_filled));
                        if(addByWord5==false)
                        {
                            addByWord5=true;

                        }
                    }
                }
            }
            if(addByWord1&&addByWord2&&addByWord3&&addByWord4&&addByWord5&&addByWord6&&addByWord6){
                score = String.valueOf(Integer.parseInt(score)+999);
                winFlag=true;
                MainActivity.mainActivity.isWin();
            }
        }else if(levelSetting == 5){

        }

    }


    int[] loc1= new int[2];
    int[] loc2= new int[2];
    int[] loc3= new int[2];
    int[] loc4= new int[2];
    int[] loc5= new int[2];
    int[] loc6= new int[2];
    int[] loc7= new int[2];
    int[] loc8= new int[2];

    public void StartGame(){//关卡内部的 答案 空白 显示文字等等的初始化
        //以及获取各个按钮的位置getLocationOnScreen

        if(levelSetting==1) {//关卡1
            task(levelSetting,MainActivity.mainActivity.btn24,
                    MainActivity.mainActivity.btn32,
                    MainActivity.mainActivity.btn33,
                    MainActivity.mainActivity.btn35,
                    MainActivity.mainActivity.btn44);//题目放置

            MainActivity.mainActivity.btn34.getLocationOnScreen(loc1);
            MainActivity.mainActivity.btn54.getLocationOnScreen(loc2);
            getLocBlank(loc1[0],loc1[1],loc2[0],loc2[1]);//获取空白格的位置信息
            blank(MainActivity.mainActivity.btn34,MainActivity.mainActivity.btn54);//空白放置

            answer(levelSetting,MainActivity.mainActivity.word1,MainActivity.mainActivity.word2);//选项放置

            MainActivity.mainActivity.openingAnimation.openAnimation(MainActivity.mainActivity.btn24, MainActivity.mainActivity.btn32, MainActivity.mainActivity.btn33,
                    MainActivity.mainActivity.btn35, MainActivity.mainActivity.btn44,MainActivity.mainActivity.btn34,MainActivity.mainActivity.btn54,
                    MainActivity.mainActivity.word1,MainActivity.mainActivity.word2);
        }else if(levelSetting == 2){//关卡2
            task(levelSetting,MainActivity.mainActivity.btn24,
                    MainActivity.mainActivity.btn32,
                    MainActivity.mainActivity.btn33,
                    MainActivity.mainActivity.btn44,
                    MainActivity.mainActivity.btn54);//题目放置

            MainActivity.mainActivity.btn34.getLocationOnScreen(loc1);
            MainActivity.mainActivity.btn35.getLocationOnScreen(loc2);
            getLocBlank(loc1[0],loc1[1],loc2[0],loc2[1]);
            blank(MainActivity.mainActivity.btn34,MainActivity.mainActivity.btn35);//空白放置

            answer(levelSetting,MainActivity.mainActivity.word1,MainActivity.mainActivity.word2);//选项放置
            MainActivity.mainActivity.openingAnimation.openAnimation(MainActivity.mainActivity.btn24,
                    MainActivity.mainActivity.btn32,MainActivity.mainActivity.btn33,MainActivity.mainActivity.btn34,
                    MainActivity.mainActivity.btn35,MainActivity.mainActivity.btn44,MainActivity.mainActivity.btn54,
                    MainActivity.mainActivity.word1,MainActivity.mainActivity.word2);
        }else if(levelSetting == 3){//关卡3
            task(levelSetting,MainActivity.mainActivity.btn15,
                    MainActivity.mainActivity.btn33,
                    MainActivity.mainActivity.btn35,
                    MainActivity.mainActivity.btn42,
                    MainActivity.mainActivity.btn44,
                    MainActivity.mainActivity.btn53);//题目放置

            MainActivity.mainActivity.btn23.getLocationOnScreen(loc1);
            MainActivity.mainActivity.btn25.getLocationOnScreen(loc2);
            MainActivity.mainActivity.btn43.getLocationOnScreen(loc3);
            MainActivity.mainActivity.btn45.getLocationOnScreen(loc4);
            getLocBlank(loc1[0],loc1[1],loc2[0],loc2[1],loc3[0],loc3[1],loc4[0],loc4[1]);
            blank(MainActivity.mainActivity.btn23,MainActivity.mainActivity.btn25,
                    MainActivity.mainActivity.btn43,MainActivity.mainActivity.btn45);
            answer(levelSetting,MainActivity.mainActivity.word1,MainActivity.mainActivity.word2,
                    MainActivity.mainActivity.word3,MainActivity.mainActivity.word4);
            MainActivity.mainActivity.openingAnimation.openAnimation(MainActivity.mainActivity.btn15,
                    MainActivity.mainActivity.btn23,MainActivity.mainActivity.btn25,MainActivity.mainActivity.btn33,
                    MainActivity.mainActivity.btn35,MainActivity.mainActivity.btn42,MainActivity.mainActivity.btn42,
                    MainActivity.mainActivity.btn43,MainActivity.mainActivity.btn44,MainActivity.mainActivity.btn45,
                    MainActivity.mainActivity.btn53,MainActivity.mainActivity.word1,MainActivity.mainActivity.word2,
                    MainActivity.mainActivity.word3,MainActivity.mainActivity.word4);
        }else if(levelSetting == 4){//关卡4
            task(levelSetting,MainActivity.mainActivity.btn22,
                    MainActivity.mainActivity.btn23,MainActivity.mainActivity.btn32,
                    MainActivity.mainActivity.btn45,MainActivity.mainActivity.btn54,
                    MainActivity.mainActivity.btn55);//题目放置

            MainActivity.mainActivity.btn24.getLocationOnScreen(loc1);
            MainActivity.mainActivity.btn25.getLocationOnScreen(loc2);
            MainActivity.mainActivity.btn35.getLocationOnScreen(loc3);
            MainActivity.mainActivity.btn42.getLocationOnScreen(loc4);
            MainActivity.mainActivity.btn52.getLocationOnScreen(loc5);
            MainActivity.mainActivity.btn53.getLocationOnScreen(loc6);
            getLocBlank(loc1[0],loc1[1],loc2[0],loc2[1],loc3[0],loc3[1],loc4[0],loc4[1],loc5[0],loc5[1],loc6[0],loc6[1]);
            blank(MainActivity.mainActivity.btn24,MainActivity.mainActivity.btn25,MainActivity.mainActivity.btn35,
                    MainActivity.mainActivity.btn42,MainActivity.mainActivity.btn52,MainActivity.mainActivity.btn53);
            answer(levelSetting,MainActivity.mainActivity.word1,MainActivity.mainActivity.word2,
                    MainActivity.mainActivity.word3,MainActivity.mainActivity.word4,
                    MainActivity.mainActivity.word5,MainActivity.mainActivity.word6,
                    MainActivity.mainActivity.word7,MainActivity.mainActivity.word8);
            MainActivity.mainActivity.openingAnimation.openAnimation(MainActivity.mainActivity.btn22,
                    MainActivity.mainActivity.btn23,MainActivity.mainActivity.btn24,MainActivity.mainActivity.btn25,
                    MainActivity.mainActivity.btn32,MainActivity.mainActivity.btn35,MainActivity.mainActivity.btn42,
                    MainActivity.mainActivity.btn45,MainActivity.mainActivity.btn52,MainActivity.mainActivity.btn53,
                    MainActivity.mainActivity.btn54,MainActivity.mainActivity.btn55,MainActivity.mainActivity.word1,
                    MainActivity.mainActivity.word2,MainActivity.mainActivity.word3,MainActivity.mainActivity.word4,
                    MainActivity.mainActivity.word5,MainActivity.mainActivity.word6,MainActivity.mainActivity.word7,
                    MainActivity.mainActivity.word8);
        }
        locatorInfo(MainActivity.mainActivity.locator);//getLocBlank调用时已经获取首个空白的位置,此方法完成locator初始位置设置

    }



    //contentsClick 在Click中调用
    public void  contentsClick(int level) {
        if (level == 1) {//level1
            if (count == 0) {//word1
                //word1 locatorMoving
                TranslateAnimation w1lTranslateAnimation = new TranslateAnimation(
                        Animation.ABSOLUTE, locBlank1[0] - 10,
                        Animation.ABSOLUTE, locBlank2[0] - 10,
                        Animation.ABSOLUTE, locBlank1[1] - 90,
                        Animation.ABSOLUTE, locBlank2[1] - 90);
                w1lTranslateAnimation.setDuration(200);
                w1lTranslateAnimation.setFillAfter(true);
//                locatorMoving.startAnimation(w1lTranslateAnimation);
                //word1 answerMoving
                TranslateAnimation w1aTranslateAnimation = new TranslateAnimation(
                        Animation.RELATIVE_TO_SELF, 0,
                        Animation.ABSOLUTE, locBlank1[0] - MainActivity.mainActivity.word1.getLeft(),
                        Animation.RELATIVE_TO_SELF, 0,
                        Animation.ABSOLUTE, locBlank1[1] - MainActivity.mainActivity.word1.getTop() - 80);
                w1aTranslateAnimation.setDuration(300);
                w1aTranslateAnimation.setFillAfter(true);
//                MainActivity.mainActivity.word1.startAnimation(w1aTranslateAnimation);


                //word2locatorMoving
                TranslateAnimation w2lTranslateAnimation = new TranslateAnimation(
                        Animation.ABSOLUTE, locBlank1[0] - 10,
                        Animation.ABSOLUTE, locBlank2[0] - 10,
                        Animation.ABSOLUTE, locBlank1[1] - 90,
                        Animation.ABSOLUTE, locBlank2[1] - 90);
                w2lTranslateAnimation.setDuration(200);
                w2lTranslateAnimation.setFillAfter(true);
//                locatorMoving.startAnimation(w2lTranslateAnimation);
                //word2answerMoving
                TranslateAnimation w2aTranslateAnimation = new TranslateAnimation(
                        Animation.RELATIVE_TO_SELF, 0,
                        Animation.ABSOLUTE, locBlank1[0] - MainActivity.mainActivity.word2.getLeft(),
                        Animation.RELATIVE_TO_SELF, 0,
                        Animation.ABSOLUTE, locBlank1[1] - MainActivity.mainActivity.word2.getTop() - 80);
                w2aTranslateAnimation.setDuration(300);
                w2aTranslateAnimation.setFillAfter(true);
//                MainActivity.mainActivity.word2.startAnimation(w2aTranslateAnimation);
//                count++;

                translateAnimations1 = new TranslateAnimation[]{w1lTranslateAnimation, w1aTranslateAnimation};
                translateAnimations2 = new TranslateAnimation[]{w2lTranslateAnimation, w2aTranslateAnimation};
                translateAnimationsList.add(0, translateAnimations1);
                translateAnimationsList.add(1, translateAnimations2);


                if (word1Flag) {
                    MainActivity.mainActivity.locator.startAnimation(translateAnimationsList.get(0)[0]);
                    MainActivity.mainActivity.word1.startAnimation(translateAnimationsList.get(0)[1]);
                } else if (word2Flag) {
                    MainActivity.mainActivity.locator.startAnimation(translateAnimationsList.get(1)[0]);
                    MainActivity.mainActivity.word2.startAnimation(translateAnimationsList.get(1)[1]);
                    isw2R = true;
                }

            } else if (count == 1) {//word1
                //word1 locatorMoving
                TranslateAnimation w1lTranslateAnimation = new TranslateAnimation(
                        Animation.ABSOLUTE, locBlank2[0] - 10,
                        Animation.ABSOLUTE, 0,
                        Animation.ABSOLUTE, locBlank2[1] - 90,
                        Animation.ABSOLUTE, 0
                );
                w1lTranslateAnimation.setDuration(200);
                w1lTranslateAnimation.setFillAfter(true);
//                locatorMoving.startAnimation(w1lTranslateAnimation);
                //word1 answerMoving
                TranslateAnimation w1aTranslateAnimation = new TranslateAnimation(
                        Animation.RELATIVE_TO_SELF, 0,
                        Animation.ABSOLUTE, locBlank2[0] - MainActivity.mainActivity.word1.getLeft(),
                        Animation.RELATIVE_TO_SELF, 0,
                        Animation.ABSOLUTE, locBlank2[1] - MainActivity.mainActivity.word1.getTop() - 80
                );
                w1aTranslateAnimation.setDuration(200);
                w1aTranslateAnimation.setFillAfter(true);
//                MainActivity.mainActivity.word1.startAnimation(w2aTranslateAnimation);
                //word2 locatorMoving
                TranslateAnimation w2lTranslateAnimation = new TranslateAnimation(
                        Animation.ABSOLUTE, locBlank2[0] - 10,
                        Animation.ABSOLUTE, 0,
                        Animation.ABSOLUTE, locBlank2[1] - 90,
                        Animation.ABSOLUTE, 0
                );
                w2lTranslateAnimation.setDuration(200);
                w2lTranslateAnimation.setFillAfter(true);
//                locatorMoving.startAnimation(w2lTranslateAnimation);
                //word2 answerMoving
                TranslateAnimation w2aTranslateAnimation = new TranslateAnimation(
                        Animation.RELATIVE_TO_SELF, 0,
                        Animation.ABSOLUTE, locBlank2[0] - MainActivity.mainActivity.word2.getLeft(),
                        Animation.RELATIVE_TO_SELF, 0,
                        Animation.ABSOLUTE, locBlank2[1] - MainActivity.mainActivity.word2.getTop() - 80
                );
                w2aTranslateAnimation.setDuration(200);
                w2aTranslateAnimation.setFillAfter(true);
//                MainActivity.mainActivity.word2.startAnimation(w2aTranslateAnimation);

                translateAnimations1 = new TranslateAnimation[]{w1lTranslateAnimation, w1aTranslateAnimation};
                translateAnimations2 = new TranslateAnimation[]{w2lTranslateAnimation, w2aTranslateAnimation};
                translateAnimationsList.add(0, translateAnimations1);
                translateAnimationsList.add(1, translateAnimations2);
                if (word1Flag) {

                    MainActivity.mainActivity.locator.startAnimation(translateAnimationsList.get(0)[0]);
                    MainActivity.mainActivity.word1.startAnimation(translateAnimationsList.get(0)[1]);
                    isw1R = true;
                } else if (word2Flag) {
                    MainActivity.mainActivity.locator.startAnimation(translateAnimationsList.get(1)[0]);
                    MainActivity.mainActivity.word2.startAnimation(translateAnimationsList.get(1)[1]);
                }

            }

        }//level1结束

        if (level == 2) {
            if (count == 0) {
                //word1locatorMoving
                TranslateAnimation w1lTranslateAnimation = new TranslateAnimation(
                        Animation.ABSOLUTE, locBlank1[0] - 10,
                        Animation.ABSOLUTE, locBlank2[0] - 10,
                        Animation.ABSOLUTE, locBlank1[1] - 90,
                        Animation.ABSOLUTE, locBlank2[1] - 90);
                w1lTranslateAnimation.setDuration(200);
                w1lTranslateAnimation.setFillAfter(true);
//                locatorMoving.startAnimation(w1lTranslateAnimation);
                //word1 answerMoving
                TranslateAnimation w1aTranslateAnimation = new TranslateAnimation(
                        Animation.RELATIVE_TO_SELF, 0,
                        Animation.ABSOLUTE, locBlank1[0] - MainActivity.mainActivity.word1.getLeft(),
                        Animation.RELATIVE_TO_SELF, 0,
                        Animation.ABSOLUTE, locBlank1[1] - MainActivity.mainActivity.word1.getTop() - 80);
                w1aTranslateAnimation.setDuration(300);
                w1aTranslateAnimation.setFillAfter(true);
//                MainActivity.mainActivity.word1.startAnimation(w1aTranslateAnimation);

                //word2locatorMoving
                TranslateAnimation w2lTranslateAnimation = new TranslateAnimation(
                        Animation.ABSOLUTE, locBlank1[0] - 10,
                        Animation.ABSOLUTE, locBlank2[0] - 10,
                        Animation.ABSOLUTE, locBlank1[1] - 90,
                        Animation.ABSOLUTE, locBlank2[1] - 90);
                w2lTranslateAnimation.setDuration(200);
                w2lTranslateAnimation.setFillAfter(true);
//                locatorMoving.startAnimation(w2lTranslateAnimation);
                //word2answerMoving
                TranslateAnimation w2aTranslateAnimation = new TranslateAnimation(
                        Animation.RELATIVE_TO_SELF, 0,
                        Animation.ABSOLUTE, locBlank1[0] - MainActivity.mainActivity.word2.getLeft(),
                        Animation.RELATIVE_TO_SELF, 0,
                        Animation.ABSOLUTE, locBlank1[1] - MainActivity.mainActivity.word2.getTop() - 80);
                w2aTranslateAnimation.setDuration(300);
                w2aTranslateAnimation.setFillAfter(true);
//                MainActivity.mainActivity.word2.startAnimation(w2aTranslateAnimation);
//                count++;

                translateAnimations1 = new TranslateAnimation[]{w1lTranslateAnimation, w1aTranslateAnimation};
                translateAnimations2 = new TranslateAnimation[]{w2lTranslateAnimation, w2aTranslateAnimation};
                translateAnimationsList.add(0, translateAnimations1);
                translateAnimationsList.add(1, translateAnimations2);


                if (word1Flag) {
                    MainActivity.mainActivity.locator.startAnimation(translateAnimationsList.get(0)[0]);
                    MainActivity.mainActivity.word1.startAnimation(translateAnimationsList.get(0)[1]);
                } else if (word2Flag) {
                    MainActivity.mainActivity.btn34.setText("回");
                    MainActivity.mainActivity.locator.startAnimation(translateAnimationsList.get(1)[0]);
                    MainActivity.mainActivity.word2.startAnimation(translateAnimationsList.get(1)[1]);
                }

            } else if (count == 1) {//word1
                //word1 locatorMoving
                TranslateAnimation w1lTranslateAnimation = new TranslateAnimation(
                        Animation.ABSOLUTE, locBlank2[0] - 10,
                        Animation.ABSOLUTE, 0,
                        Animation.ABSOLUTE, locBlank2[1] - 90,
                        Animation.ABSOLUTE, 0
                );
                w1lTranslateAnimation.setDuration(200);
                w1lTranslateAnimation.setFillAfter(true);
//                locatorMoving.startAnimation(w1lTranslateAnimation);
                //word1 answerMoving
                TranslateAnimation w1aTranslateAnimation = new TranslateAnimation(
                        Animation.RELATIVE_TO_SELF, 0,
                        Animation.ABSOLUTE, locBlank2[0] - MainActivity.mainActivity.word1.getLeft(),
                        Animation.RELATIVE_TO_SELF, 0,
                        Animation.ABSOLUTE, locBlank2[1] - MainActivity.mainActivity.word1.getTop() - 80
                );
                w1aTranslateAnimation.setDuration(200);
                w1aTranslateAnimation.setFillAfter(true);
//                MainActivity.mainActivity.word1.startAnimation(w2aTranslateAnimation);
                //word2 locatorMoving
                TranslateAnimation w2lTranslateAnimation = new TranslateAnimation(
                        Animation.ABSOLUTE, locBlank2[0] - 10,
                        Animation.ABSOLUTE, 0,
                        Animation.ABSOLUTE, locBlank2[1] - 90,
                        Animation.ABSOLUTE, 0
                );
                w2lTranslateAnimation.setDuration(200);
                w2lTranslateAnimation.setFillAfter(true);
//                locatorMoving.startAnimation(w2lTranslateAnimation);
                //word2 answerMoving
                TranslateAnimation w2aTranslateAnimation = new TranslateAnimation(
                        Animation.RELATIVE_TO_SELF, 0,
                        Animation.ABSOLUTE, locBlank2[0] - MainActivity.mainActivity.word2.getLeft(),
                        Animation.RELATIVE_TO_SELF, 0,
                        Animation.ABSOLUTE, locBlank2[1] - MainActivity.mainActivity.word2.getTop() - 80
                );
                w2aTranslateAnimation.setDuration(200);
                w2aTranslateAnimation.setFillAfter(true);
//                MainActivity.mainActivity.word2.startAnimation(w2aTranslateAnimation);

                translateAnimations1 = new TranslateAnimation[]{w1lTranslateAnimation, w1aTranslateAnimation};
                translateAnimations2 = new TranslateAnimation[]{w2lTranslateAnimation, w2aTranslateAnimation};
                translateAnimationsList.add(0, translateAnimations1);
                translateAnimationsList.add(1, translateAnimations2);
                if (word1Flag) {
                    MainActivity.mainActivity.btn35.setText("春");
                    MainActivity.mainActivity.locator.startAnimation(translateAnimationsList.get(0)[0]);
                    MainActivity.mainActivity.word1.startAnimation(translateAnimationsList.get(0)[1]);
                } else if (word2Flag) {
                    MainActivity.mainActivity.locator.startAnimation(translateAnimationsList.get(1)[0]);
                    MainActivity.mainActivity.word2.startAnimation(translateAnimationsList.get(1)[1]);
                }
            }//count==1结束

        }//level2结束

        if(level == 3){
            if(count == 0){
                //locatorMoving
                TranslateAnimation lTranslateAnimation = new TranslateAnimation(
                        Animation.ABSOLUTE,locBlank1[0]-10,
                        Animation.ABSOLUTE,locBlank2[0]-10,
                        Animation.ABSOLUTE,locBlank1[1]-90,
                        Animation.ABSOLUTE,locBlank2[1]-90);
                lTranslateAnimation.setDuration(200);
                lTranslateAnimation.setFillAfter(true);
                //w1a
                TranslateAnimation w1aTA = new TranslateAnimation(
                        Animation.RELATIVE_TO_SELF,0,
                        Animation.ABSOLUTE,locBlank1[0]-MainActivity.mainActivity.word1.getLeft(),
                        Animation.RELATIVE_TO_SELF,0,
                        Animation.ABSOLUTE,locBlank1[1]-MainActivity.mainActivity.word1.getTop()-80);
                w1aTA.setDuration(200);
                w1aTA.setFillAfter(true);
                //w2a
                TranslateAnimation w2aTA = new TranslateAnimation(
                        Animation.RELATIVE_TO_SELF,0,
                        Animation.ABSOLUTE,locBlank1[0]-MainActivity.mainActivity.word2.getLeft(),
                        Animation.RELATIVE_TO_SELF,0,
                        Animation.ABSOLUTE,locBlank1[1]-MainActivity.mainActivity.word2.getTop()-80);
                w2aTA.setDuration(200);
                w2aTA.setFillAfter(true);
                //w3a
                TranslateAnimation w3aTA = new TranslateAnimation(
                        Animation.RELATIVE_TO_SELF,0,
                        Animation.ABSOLUTE,locBlank1[0]-MainActivity.mainActivity.word3.getLeft(),
                        Animation.RELATIVE_TO_SELF,0,
                        Animation.ABSOLUTE,locBlank1[1]-MainActivity.mainActivity.word3.getTop()-80);
                w3aTA.setDuration(200);
                w3aTA.setFillAfter(true);
                //w4a
                TranslateAnimation w4aTA = new TranslateAnimation(
                        Animation.RELATIVE_TO_SELF,0,
                        Animation.ABSOLUTE,locBlank1[0]-MainActivity.mainActivity.word4.getLeft(),
                        Animation.RELATIVE_TO_SELF,0,
                        Animation.ABSOLUTE,locBlank1[1]-MainActivity.mainActivity.word4.getTop()-80);
                w4aTA.setDuration(200);
                w4aTA.setFillAfter(true);

                translateAnimations1 = new TranslateAnimation[]{lTranslateAnimation};
                translateAnimations2 = new TranslateAnimation[]{w1aTA,w2aTA,w3aTA,w4aTA};
                translateAnimationsList.add(0, translateAnimations1);
                translateAnimationsList.add(1, translateAnimations2);

                if (word1Flag) {
                    MainActivity.mainActivity.locator.startAnimation(translateAnimationsList.get(0)[0]);
                    MainActivity.mainActivity.word1.startAnimation(translateAnimationsList.get(1)[0]);
                } else if (word2Flag) {
                    MainActivity.mainActivity.locator.startAnimation(translateAnimationsList.get(0)[0]);
                    MainActivity.mainActivity.word2.startAnimation(translateAnimationsList.get(1)[1]);
                } else if (word3Flag) {
                    MainActivity.mainActivity.locator.startAnimation(translateAnimationsList.get(0)[0]);
                    MainActivity.mainActivity.word3.startAnimation(translateAnimationsList.get(1)[2]);
                }else if (word4Flag) {
                    MainActivity.mainActivity.btn23.setText("设");
                    MainActivity.mainActivity.locator.startAnimation(translateAnimationsList.get(0)[0]);
                    MainActivity.mainActivity.word4.startAnimation(translateAnimationsList.get(1)[3]);
                }
            }else if(count==1){
                //locatorMoving
                TranslateAnimation lTranslateAnimation = new TranslateAnimation(
                        Animation.ABSOLUTE,locBlank2[0]-10,
                        Animation.ABSOLUTE,locBlank3[0]-10,
                        Animation.ABSOLUTE,locBlank2[1]-90,
                        Animation.ABSOLUTE,locBlank3[1]-90);
                lTranslateAnimation.setDuration(200);
                lTranslateAnimation.setFillAfter(true);
                //w1a
                TranslateAnimation w1aTA = new TranslateAnimation(
                        Animation.RELATIVE_TO_SELF,0,
                        Animation.ABSOLUTE,locBlank2[0]-MainActivity.mainActivity.word1.getLeft(),
                        Animation.RELATIVE_TO_SELF,0,
                        Animation.ABSOLUTE,locBlank2[1]-MainActivity.mainActivity.word1.getTop()-80);
                w1aTA.setDuration(200);
                w1aTA.setFillAfter(true);
                //w2a
                TranslateAnimation w2aTA = new TranslateAnimation(
                        Animation.RELATIVE_TO_SELF,0,
                        Animation.ABSOLUTE,locBlank2[0]-MainActivity.mainActivity.word2.getLeft(),
                        Animation.RELATIVE_TO_SELF,0,
                        Animation.ABSOLUTE,locBlank2[1]-MainActivity.mainActivity.word2.getTop()-80);
                w2aTA.setDuration(200);
                w2aTA.setFillAfter(true);
                //w3a
                TranslateAnimation w3aTA = new TranslateAnimation(
                        Animation.RELATIVE_TO_SELF,0,
                        Animation.ABSOLUTE,locBlank2[0]-MainActivity.mainActivity.word3.getLeft(),
                        Animation.RELATIVE_TO_SELF,0,
                        Animation.ABSOLUTE,locBlank2[1]-MainActivity.mainActivity.word3.getTop()-80);
                w3aTA.setDuration(200);
                w3aTA.setFillAfter(true);
                //w4a
                TranslateAnimation w4aTA = new TranslateAnimation(
                        Animation.RELATIVE_TO_SELF,0,
                        Animation.ABSOLUTE,locBlank2[0]-MainActivity.mainActivity.word4.getLeft(),
                        Animation.RELATIVE_TO_SELF,0,
                        Animation.ABSOLUTE,locBlank2[1]-MainActivity.mainActivity.word4.getTop()-80);
                w4aTA.setDuration(200);
                w4aTA.setFillAfter(true);

                translateAnimations1 = new TranslateAnimation[]{lTranslateAnimation};
                translateAnimations2 = new TranslateAnimation[]{w1aTA,w2aTA,w3aTA,w4aTA};
                translateAnimationsList.add(0, translateAnimations1);
                translateAnimationsList.add(1, translateAnimations2);

                if (word1Flag) {
                    MainActivity.mainActivity.btn25.setText("笑");
                    MainActivity.mainActivity.locator.startAnimation(translateAnimationsList.get(0)[0]);
                    MainActivity.mainActivity.word1.startAnimation(translateAnimationsList.get(1)[0]);
                } else if (word2Flag) {
                    MainActivity.mainActivity.locator.startAnimation(translateAnimationsList.get(0)[0]);
                    MainActivity.mainActivity.word2.startAnimation(translateAnimationsList.get(1)[1]);
                } else if (word3Flag) {
                    MainActivity.mainActivity.locator.startAnimation(translateAnimationsList.get(0)[0]);
                    MainActivity.mainActivity.word3.startAnimation(translateAnimationsList.get(1)[2]);
                }else if (word4Flag) {
                    MainActivity.mainActivity.locator.startAnimation(translateAnimationsList.get(0)[0]);
                    MainActivity.mainActivity.word4.startAnimation(translateAnimationsList.get(1)[3]);
                }
            }else if(count==2){
                //locatorMoving
                TranslateAnimation lTranslateAnimation = new TranslateAnimation(
                        Animation.ABSOLUTE,locBlank3[0]-10,
                        Animation.ABSOLUTE,locBlank4[0]-10,
                        Animation.ABSOLUTE,locBlank3[1]-90,
                        Animation.ABSOLUTE,locBlank4[1]-90);
                lTranslateAnimation.setDuration(200);
                lTranslateAnimation.setFillAfter(true);
                //w1a
                TranslateAnimation w1aTA = new TranslateAnimation(
                        Animation.RELATIVE_TO_SELF,0,
                        Animation.ABSOLUTE,locBlank3[0]-MainActivity.mainActivity.word1.getLeft(),
                        Animation.RELATIVE_TO_SELF,0,
                        Animation.ABSOLUTE,locBlank3[1]-MainActivity.mainActivity.word1.getTop()-80);
                w1aTA.setDuration(200);
                w1aTA.setFillAfter(true);
                //w2a
                TranslateAnimation w2aTA = new TranslateAnimation(
                        Animation.RELATIVE_TO_SELF,0,
                        Animation.ABSOLUTE,locBlank3[0]-MainActivity.mainActivity.word2.getLeft(),
                        Animation.RELATIVE_TO_SELF,0,
                        Animation.ABSOLUTE,locBlank3[1]-MainActivity.mainActivity.word2.getTop()-80);
                w2aTA.setDuration(200);
                w2aTA.setFillAfter(true);
                //w3a
                TranslateAnimation w3aTA = new TranslateAnimation(
                        Animation.RELATIVE_TO_SELF,0,
                        Animation.ABSOLUTE,locBlank3[0]-MainActivity.mainActivity.word3.getLeft(),
                        Animation.RELATIVE_TO_SELF,0,
                        Animation.ABSOLUTE,locBlank3[1]-MainActivity.mainActivity.word3.getTop()-80);
                w3aTA.setDuration(200);
                w3aTA.setFillAfter(true);
                //w4a
                TranslateAnimation w4aTA = new TranslateAnimation(
                        Animation.RELATIVE_TO_SELF,0,
                        Animation.ABSOLUTE,locBlank3[0]-MainActivity.mainActivity.word4.getLeft(),
                        Animation.RELATIVE_TO_SELF,0,
                        Animation.ABSOLUTE,locBlank3[1]-MainActivity.mainActivity.word4.getTop()-80);
                w4aTA.setDuration(200);
                w4aTA.setFillAfter(true);

                translateAnimations1 = new TranslateAnimation[]{lTranslateAnimation};
                translateAnimations2 = new TranslateAnimation[]{w1aTA,w2aTA,w3aTA,w4aTA};
                translateAnimationsList.add(0, translateAnimations1);
                translateAnimationsList.add(1, translateAnimations2);

                if (word1Flag) {
                    MainActivity.mainActivity.locator.startAnimation(translateAnimationsList.get(0)[0]);
                    MainActivity.mainActivity.word1.startAnimation(translateAnimationsList.get(1)[0]);
                } else if (word2Flag) {
                    MainActivity.mainActivity.btn43.setText("处");
                    MainActivity.mainActivity.locator.startAnimation(translateAnimationsList.get(0)[0]);
                    MainActivity.mainActivity.word2.startAnimation(translateAnimationsList.get(1)[1]);
                } else if (word3Flag) {
                    MainActivity.mainActivity.locator.startAnimation(translateAnimationsList.get(0)[0]);
                    MainActivity.mainActivity.word3.startAnimation(translateAnimationsList.get(1)[2]);
                }else if (word4Flag) {
                    MainActivity.mainActivity.locator.startAnimation(translateAnimationsList.get(0)[0]);
                    MainActivity.mainActivity.word4.startAnimation(translateAnimationsList.get(1)[3]);
                }
            }else if(count==3){
                //locatorMoving
                TranslateAnimation lTranslateAnimation = new TranslateAnimation(
                        Animation.ABSOLUTE,locBlank4[0]-10,
                        Animation.ABSOLUTE,0,
                        Animation.ABSOLUTE,locBlank4[1]-90,
                        Animation.ABSOLUTE,0);
                lTranslateAnimation.setDuration(200);
                lTranslateAnimation.setFillAfter(true);
                //w1a
                TranslateAnimation w1aTA = new TranslateAnimation(
                        Animation.RELATIVE_TO_SELF,0,
                        Animation.ABSOLUTE,locBlank4[0]-MainActivity.mainActivity.word1.getLeft(),
                        Animation.RELATIVE_TO_SELF,0,
                        Animation.ABSOLUTE,locBlank4[1]-MainActivity.mainActivity.word1.getTop()-80);
                w1aTA.setDuration(200);
                w1aTA.setFillAfter(true);
                //w2a
                TranslateAnimation w2aTA = new TranslateAnimation(
                        Animation.RELATIVE_TO_SELF,0,
                        Animation.ABSOLUTE,locBlank4[0]-MainActivity.mainActivity.word2.getLeft(),
                        Animation.RELATIVE_TO_SELF,0,
                        Animation.ABSOLUTE,locBlank4[1]-MainActivity.mainActivity.word2.getTop()-80);
                w2aTA.setDuration(200);
                w2aTA.setFillAfter(true);
                //w3a
                TranslateAnimation w3aTA = new TranslateAnimation(
                        Animation.RELATIVE_TO_SELF,0,
                        Animation.ABSOLUTE,locBlank4[0]-MainActivity.mainActivity.word3.getLeft(),
                        Animation.RELATIVE_TO_SELF,0,
                        Animation.ABSOLUTE,locBlank4[1]-MainActivity.mainActivity.word3.getTop()-80);
                w3aTA.setDuration(200);
                w3aTA.setFillAfter(true);
                //w4a
                TranslateAnimation w4aTA = new TranslateAnimation(
                        Animation.RELATIVE_TO_SELF,0,
                        Animation.ABSOLUTE,locBlank4[0]-MainActivity.mainActivity.word4.getLeft(),
                        Animation.RELATIVE_TO_SELF,0,
                        Animation.ABSOLUTE,locBlank4[1]-MainActivity.mainActivity.word4.getTop()-80);
                w4aTA.setDuration(200);
                w4aTA.setFillAfter(true);

                translateAnimations1 = new TranslateAnimation[]{lTranslateAnimation};
                translateAnimations2 = new TranslateAnimation[]{w1aTA,w2aTA,w3aTA,w4aTA};
                translateAnimationsList.add(0, translateAnimations1);
                translateAnimationsList.add(1, translateAnimations2);

                if (word1Flag) {
                    MainActivity.mainActivity.locator.startAnimation(translateAnimationsList.get(0)[0]);
                    MainActivity.mainActivity.word1.startAnimation(translateAnimationsList.get(1)[0]);
                } else if (word2Flag) {
                    MainActivity.mainActivity.locator.startAnimation(translateAnimationsList.get(0)[0]);
                    MainActivity.mainActivity.word2.startAnimation(translateAnimationsList.get(1)[1]);
                } else if (word3Flag) {
                    MainActivity.mainActivity.btn45.setText("生");
                    MainActivity.mainActivity.locator.startAnimation(translateAnimationsList.get(0)[0]);
                    MainActivity.mainActivity.word3.startAnimation(translateAnimationsList.get(1)[2]);
                }else if (word4Flag) {
                    MainActivity.mainActivity.locator.startAnimation(translateAnimationsList.get(0)[0]);
                    MainActivity.mainActivity.word4.startAnimation(translateAnimationsList.get(1)[3]);
                }
            }
        }//level==3结束

        if(levelSetting==4){//关卡4
            if(count==0){
                moveUtils.allSet(count,locBlank1,locBlank2,locBlank3,locBlank4,locBlank5,locBlank6,locBlank7);
                if(word4Flag){
                    MainActivity.mainActivity.btn24.setText("所");
                    isw4R = true;
                }
                moveUtils.startMove(moveUtils.ltranslateAnimation,
                        moveUtils.w1aTA, moveUtils.w2aTA, moveUtils.w3aTA, moveUtils.w4aTA,
                        moveUtils.w5aTA,moveUtils.w6aTA,moveUtils.w7aTA, moveUtils.w8aTA,
                        word1Flag,word2Flag,word3Flag,word4Flag,word5Flag,word6Flag, word7Flag,word8Flag);
            }else if(count==1){
                moveUtils.allSet(count,locBlank1,locBlank2,locBlank3,locBlank4,locBlank5,locBlank6,locBlank7);
                if(word1Flag){
                    MainActivity.mainActivity.btn25.setText("措");
                    isw1R = true;
                }
                moveUtils.startMove(moveUtils.ltranslateAnimation,
                        moveUtils.w1aTA, moveUtils.w2aTA, moveUtils.w3aTA, moveUtils.w4aTA,
                        moveUtils.w5aTA,moveUtils.w6aTA,moveUtils.w7aTA, moveUtils.w8aTA,
                        word1Flag,word2Flag,word3Flag,word4Flag,word5Flag,word6Flag, word7Flag,word8Flag);
            }else if(count==2){
                moveUtils.allSet(count,locBlank1,locBlank2,locBlank3,locBlank4,locBlank5,locBlank6,locBlank7);
                if(word6Flag){
                    MainActivity.mainActivity.btn35.setText("手");
                    isw6R = true;
                }
                moveUtils.startMove(moveUtils.ltranslateAnimation,
                        moveUtils.w1aTA, moveUtils.w2aTA, moveUtils.w3aTA, moveUtils.w4aTA,
                        moveUtils.w5aTA,moveUtils.w6aTA,moveUtils.w7aTA, moveUtils.w8aTA,
                        word1Flag,word2Flag,word3Flag,word4Flag,word5Flag,word6Flag, word7Flag,word8Flag);
            }else if(count==3){
                moveUtils.allSet(count,locBlank1,locBlank2,locBlank3,locBlank4,locBlank5,locBlank6,locBlank7);
                if(word3Flag){
                    MainActivity.mainActivity.btn42.setText("众");
                    isw3R = true;
                }
                moveUtils.startMove(moveUtils.ltranslateAnimation,
                        moveUtils.w1aTA, moveUtils.w2aTA, moveUtils.w3aTA, moveUtils.w4aTA,
                        moveUtils.w5aTA,moveUtils.w6aTA,moveUtils.w7aTA, moveUtils.w8aTA,
                        word1Flag,word2Flag,word3Flag,word4Flag,word5Flag,word6Flag, word7Flag,word8Flag);
            }else if(count==4){
                moveUtils.allSet(count,locBlank1,locBlank2,locBlank3,locBlank4,locBlank5,locBlank6,locBlank7);
                if(word2Flag){
                    MainActivity.mainActivity.btn52.setText("望");
                    isw2R = true;
                }
                moveUtils.startMove(moveUtils.ltranslateAnimation,
                        moveUtils.w1aTA, moveUtils.w2aTA, moveUtils.w3aTA, moveUtils.w4aTA,
                        moveUtils.w5aTA,moveUtils.w6aTA,moveUtils.w7aTA, moveUtils.w8aTA,
                        word1Flag,word2Flag,word3Flag,word4Flag,word5Flag,word6Flag, word7Flag,word8Flag);
            }else if(count==5){
                moveUtils.allSet(count,locBlank1,locBlank2,locBlank3,locBlank4,locBlank5,locBlank6,locBlank7);
                if(word5Flag){
                    MainActivity.mainActivity.btn53.setText("尘");
                    isw5R = true; }
                moveUtils.startMove(moveUtils.ltranslateAnimation,
                        moveUtils.w1aTA, moveUtils.w2aTA, moveUtils.w3aTA, moveUtils.w4aTA,
                        moveUtils.w5aTA,moveUtils.w6aTA,moveUtils.w7aTA, moveUtils.w8aTA,
                        word1Flag,word2Flag,word3Flag,word4Flag,word5Flag,word6Flag, word7Flag,word8Flag);
            }
        }


    }
}
